
<%@page  import="com.gargoylesoftware.htmlunit.*,com.gargoylesoftware.htmlunit.html.*" %>
<%

     WebClient webClient = new WebClient();
     webClient = new WebClient(BrowserVersion.FIREFOX_3_6, "htproxy.entp.attws.com", 8080);
     //set proxy username and password 
    ((DefaultCredentialsProvider)webClient.getCredentialsProvider()).addProxyCredentials("itservices\\zw251y", "li196614%");
     //webClient.setProxyConfig(new ProxyConfig("proxy.entp.attws.com", "8080", true));
    // Get the first page
     HtmlPage page1 = webClient.getPage("http://www.wordsmyth.net/login/");

    // Get the form that we are dealing with and within that form, 
    // find the submit button and the field that we want to change.
    HtmlForm form = (HtmlForm) page1.getElementById("main_frm");

     HtmlSubmitInput button = form.getInputByValue("Login");
    final HtmlTextInput loginid = form.getInputByName("un");

    // Change the value of the text field
    loginid.setValueAttribute("zwu_ca@yahoo.com");
    final HtmlPasswordInput passwd = form.getInputByName("pwd");
    passwd.setValueAttribute("liliping");
    // Now submit the form by clicking the button and get back the second page.
     HtmlPage page2 = button.click();
      System.out.print(page2.asXml());
    /* page1 = webClient.getPage("http://www.wordsmyth.net/?mode=gm");
     form = (HtmlForm) page1.getElementById("main_frm");
     HtmlTextArea area = form.getTextAreaByName("dm_word_list");
     area.setText("To help you quickly create and revise multiple tools with the same word list  ");
     HtmlTextInput title = form.getInputByName("dm_title"); 
      HtmlButtonInput button2 =( HtmlButtonInput) form.getElementById("s2");
        //page2 = button2.click();
        //System.out.print(page2.asXml());
       // page2 = form.
      HtmlButton submitButton = (HtmlButton)page1.createElement("button");
   submitButton.setAttribute("type", "submit");
   form.appendChild(submitButton);
HtmlPage newPage = submitButton.click();
       System.out.print(newPage.asXml());
       
      //form = (HtmlForm) page2.getElementById("main_frm");
     // HtmlRadioButtonInput hri = (HtmlRadioButtonInput)form.getElementById("g_a_ch_a");  
      //hri.setChecked(true);             
        //  button2 =( HtmlButtonInput) form.getElementById("done"); 
    // page2 = button2.click();
     // System.out.print(page2.asXml());     */         
    webClient.closeAllWindows();


%>
